
package cn.blue.base.util;

import lombok.Data;

import java.security.PublicKey;

@Data
public class AjaxResult {
    private boolean success;
    private String msg;
    private Object resultObj;
    //通过static直接用类调出对象
    public static AjaxResult me(){
        return new AjaxResult();
    }
    public AjaxResult success(Object resultObj){
        return AjaxResult.me().setSuccess(true).setMsg("请求成功").setResultObj(resultObj);
    }
    public AjaxResult success(){
        return AjaxResult.me().setSuccess(true).setMsg("请求成功");
    }
    public AjaxResult fail(String msg){
        return AjaxResult.me().setSuccess(false).setMsg("请求失败");
    }
    public AjaxResult setSuccess(Boolean success){
        this.success = success;
        return this;

    }
    public AjaxResult setMsg(String msg){
        this.msg =msg;
        return this;
    }
    public AjaxResult setResultObj(Object resultObj){
        this.resultObj=resultObj;
        return this;
    }
}
